var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    info:null,
    shop_info: null,
    configure_show: false
  },
  showConfigure: function(){
    this.setData({
      configure_show: true
    })
  },
  hideConfigure: function () {
    this.setData({
      configure_show: false
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    wx.showLoading({
      title: '加载中…',
    })
    //
    app.ihttpGet('https://www.58zltc.com/api.php/Goods/item/id/' + options.id, function(res){
      console.log(res.data.content);
      var WxParse = require('../../../wxParse/wxParse.js');
      var article = res.data.content;
      WxParse.wxParse('article', 'html', article, that);
      that.setData({
        info: res.data
      })
      that.setShopInfo(res.data.shop_id);
      wx.setNavigationBarTitle({
        title: res.data.title,
      })
    })
  },
  setShopInfo: function (shop_id) {
    var that = this;
    wx.getStorage({
      key: 'shop_show_info',
      success: function(res) {
        console.log(res);
        that.setData({
          shop_info: res.data
        })
        wx.hideLoading();
      },
    })
  },
  
  call: function(){
    const tel = this.data.shop_info.tel;
    wx.makePhoneCall({
      phoneNumber: tel,
    })
  }
})